<?php

declare(strict_types=1);

namespace app\api\controller\customer;

use app\api\controller\Api;
use app\common\order\model\Order as ModelOrder;

class Order extends Api
{

    public function index()
    {
        $post = $this->request->post();
        if (empty($post['member_id'])) return error([], "参数错误");
        $result = [];

        $where = [];
        $where[] = ['member_id', '=', $post['member_id']];
        $model = new ModelOrder();
        $list = $model->where($where)->select();
        foreach ($list as $row) {
            $row->append(['source', 'user', 'vip', 'bom']);
        }

        $result['list'] = $list;

        return success($result);
    }
}
